<template>
	<view class="serviceMsg">
		<view style="font-size:40rpx;color:#000;font-weight: bold;line-height:100rpx;margin-bottom:20rpx;">
			消息
		</view>
		<view class="addService" @click="addMsg">
			<view>
				<image src="/static/images/member_message.png"></image>
			</view>
			<view>
				<view>添加留言</view>
				<view>有任何疑问，欢迎随时咨询</view>
			</view>
		</view>
		<view class="myServiceList">
			我的留言
		</view>
		<view class="serviceMsgListBox">
			<view v-for="(ele,ind) in messageList" @click="checkMessDetails(ele)" class="item" v-if="messageList.length>0" :key="ind">
				<view>
					<view class="messageItemImg">
						<image src="/static/images/member_boy.png"></image>
					</view>
					<view class="messageDetail">
						<view class="serviceMsgListItemTitle">
							<view class="itemName">{{ele.title}}</view>
							<view class="itemTime">{{ele.createTime}}</view>
						</view>
						<view class="itemCont">{{ele.content}}</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getMessageList
	} from "@/api/directSelling"
	export default {
		data() {
			return {
				messageList:[]
			}
		},
		created() {},
		mounted() {
			this.getMessageList();
		},
		methods: {
			getMessageList(){
				getMessageList({
					pageNumber:1,
					pageSize:100
				}).then((res)=>{
					let data=res.data.rows;
					this.messageList=data;
				})
			},
			//添加留言
			addMsg(){
				uni.navigateTo({
					url: "/pages/zx_users/serviceMsg/addMsg"
				});
			},
			//查看留言详情
			checkMessDetails(ele){
				uni.navigateTo({
					url: "/pages/zx_users/serviceMsg/msgDetails?title="+ele.title+"&createTime="+ele.createTime+"&content="+ele.content+"&id="+ele.id
				});
			}
		}
	}
</script>

<style lang="scss">
	body,
	page {
		background-color: #fff;
	}
	.serviceMsg{
		padding:20rpx 30rpx;
		box-sizing: border-box;
		.addService{
			border-bottom:1px solid #EEEEEE;
			margin-bottom:25rpx;
			image{
				width:129rpx;
				height:129rpx;
			}
			>view{
				display:inline-block;
				vertical-align: middle;
				height:150rpx;
			}
			>view:nth-child(1){
				width:150rpx;
			}
			>view:nth-child(2){
				width:calc(100% - 150rpx);
				line-height:60rpx;
			}
		}
		.myServiceList{
			line-height:50rpx;
		}
		.serviceMsgListBox{
			padding:10rpx 0rpx;
			box-sizing: border-box;
			.item{
				border-bottom:1px solid #ccc;
				height:120rpx;
				>view>view{
					display:inline-block;
					vertical-align: middle;
				}
				.messageItemImg{
					width:150rpx;
					height:120rpx;
					image{
						width:90rpx;
						height:90rpx;
						margin-top:15rpx;
						margin-left:30rpx;
					}
				}
				.messageDetail{
					width:calc(100% - 150rpx);
				}
				.serviceMsgListItemTitle{
					height:60rpx;
					line-height:60rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					.itemName{
						font-size:30rpx;
						width: calc(100% - 300rpx);
						height:60rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}
					.itemTime{
						font-size:24rpx;
						color:#aaa;
						width:256rpx;
						height:60rpx;
					}
				}
				.itemCont{
					width: calc(100% - 100rpx);
					font-size:24rpx;
					color:#aaa;
					height:40rpx;
					line-height:40rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}
			}
		}
	}
</style>
